home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / prbgi00c.zip / PRTGRAPH.H < prev    next >
C/C++ Source or Header  |  1992-03-20  |  8KB  |  204 lines

  1. /*
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  */
  5.  /*   Header file */
  6.  
  7. #if   !defined( __LARGE__) /* && !defined( __HUGE__) */
  8.    #error PRTgraph library will run only in LARGE memory model.
  9. #endif
  10.  
  11. #if   !defined(_PRT__pascal)
  12.       #define  _PRT__pascal
  13. #endif
  14.  
  15.  
  16.  #define PRT_NO_MEMORY           1
  17.  #define PRT_WRONG_PARAMETERS    2
  18.  #define PRT_NOT_INITIALIZED     3
  19.  #define PRT_IO_ERROR            4
  20.  #define PRT_ERROR               5
  21.  
  22.  
  23.  /*   drivers  */
  24.  
  25.  #define STAR_SR9    0  /* Epson ????, Star SR  */
  26.  #define IBM9        1     /* IBM GraphPrinter, ProPrinter  */
  27.  #define EPSON9      1     /* EPSON */
  28.  #define PANASONIC9  2     /* Panasonic KX-P1124 - not tested */
  29.  #define IBM9c       3     /* IBM ProPrinter (color) */
  30.  #define EPSON9c     3     /* EPSON (color) */
  31.  #define EPSON24     4     /* 24 pins EPSON compatible printer */
  32.  #define IBM24       5     /* 24 pins IBM compatible printer */
  33.  #define EPSON24c    6     /* 24 pins EPSON compatible color printer */
  34.                            /*  not tested */
  35.  #define IBM24c      7     /* 24 pins IBM compatible color printer */
  36.                            /*  not tested */
  37.  #define HPPaintJet  8     /* HP Paint Jet - not tested */
  38.  #define HPLJII      9     /* HP Laser Jet
  39.  /* #define HPLJIII     10  */
  40.  /* #define POSTSCRIPT  11  */
  41.  /* #define ROLANDP  12     */
  42.  
  43.  /* modes for particular drivers */
  44.    /* EPSON9   */
  45.       #define  EPSON9_60x72      0
  46.       #define  EPSON9_120x72     1
  47.       #define  EPSON9_120x216    2
  48.       #define  EPSON9_240x216    3
  49.    /* STAR_SR9    */
  50.       #define  STAR_SR9_60x72        0
  51.       #define  STAR_SR9_120x72       1
  52.       #define  STAR_SR9_120x144      2
  53.       #define  STAR_SR9_240x144      3
  54.    /* IBM9     */
  55.       #define  IBM9_60x72        0
  56.       #define  IBM9_120x72       1
  57.       #define  IBM9_120x216      2
  58.       #define  IBM9_240x216      3
  59.    /* EPSON24  */
  60.       #define  EPSON24_60x180     0
  61.       #define  EPSON24_120x180    1
  62.       #define  EPSON24_180x180    2
  63.       #define  EPSON24_360x180    3
  64.       #define  EPSON24_360x360    4
  65.    /* IBM24    */
  66.       #define  IBM24_60x180     0
  67.       #define  IBM24_120x180    1
  68.       #define  IBM24_180x180    2
  69.       #define  IBM24_360x180    3
  70.    /* HPPJ   */
  71.       #define  HPPJ_90x90        0
  72.       #define  HPPJ_180x180      1
  73.       #define  HPPJ_90x90c       2
  74.       #define  HPPJ_180x180c     3
  75.    /* HPLJII   */
  76.       #define  HPLJII_75x75        0
  77.       #define  HPLJII_100x100      1
  78.       #define  HPLJII_150x150      2
  79.       #define  HPLJII_300x300      3
  80.  
  81.  
  82.  /*   F U N C T I O N S    P R O T O T Y P E S  */
  83.  
  84. #define  FAR_DATA    /* far */
  85. #define  FAR_PTR        far
  86. #define  FAR_PROC    far
  87.  
  88. #ifdef __cplusplus
  89. extern "C" {
  90. #endif
  91.  
  92.  
  93. int FAR_PROC pascal PRT_SetDriver ( unsigned drv, unsigned mode,
  94.                                      unsigned width, unsigned height,
  95.                                      unsigned options );
  96.    #define  PRT_NORMAL     0
  97.    #define  PRT_ROTATE     1
  98.    #define  PRT_INVERSE    2
  99.    #define  PRT_REVERSE    2
  100.  
  101.  /* Procedures which may be called before initializing PBGI */
  102. int FAR_PROC pascal PRT_Buffer ( void far *address, long size, int usable );
  103. int FAR_PROC pascal PRT_EMSBuffer ( int handle, long size, int usable );
  104. int   FAR_PROC pascal   PRT_SetBuffer ( long size, unsigned BufOpt );
  105.       #define  NotUseEMS   1
  106.       #define  NotUseXMS   2
  107.  int FAR_PROC pascal PRT_DefineWorld ( unsigned MaxX, unsigned MaxY );
  108.  int  FAR_PROC pascal   PRT_SetOutName ( char FAR_PTR * DeviceName );
  109.  int  FAR_PROC pascal   PRT_SetMargins ( int left, int top );
  110.  int  pascal FAR_PROC   PRT_RescaleFillPattern ( int r );
  111.                         /* 0 = never, 1 = always , -1 = at high densities only */
  112.  
  113.  /* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  114.     closes PBGI, prints picture, and frees the buffer.
  115.     All above is done neccesary number of times to print
  116.     entire picture. */
  117. int FAR_PROC pascal PRT_PrintBGI (
  118.                               int far * graphdriver, int far *graphmode,
  119.                               char far *pathtodriver,
  120.                               int ( FAR_PTR * FAR_PROC  _PRT__pascal Draw)(void) );
  121.  
  122.        /* Various informing procedures */
  123.    /* May be allways called   */
  124.  unsigned   FAR_PROC pascal PRT_MaxDriver ( void );
  125.  int  FAR_PROC pascal   PRT_DriverName ( unsigned driverno, char FAR_PTR * FAR_PTR * name_ptr  );
  126.  int  FAR_PROC pascal   PRT_MaxMode ( unsigned driverno, int FAR_PTR *maxmode );
  127.  int  FAR_PROC pascal   PRT_ModeName ( unsigned driverno, int modeno,
  128.                         char FAR_PTR * FAR_PTR * name_ptr );
  129.  int  FAR_PROC pascal   PRT_DriverNo ( void );
  130.  int  FAR_PROC pascal   PRT_ModeNo ( void );
  131.  char far * FAR_PROC pascal   PRT_errormsg ( int errorcode );
  132.  
  133.    /*  May be called only after PRT_SetPicture and PRT_SetDriver */
  134.  long FAR_PROC pascal   PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  135.  int  FAR_PROC pascal   PRT_Resolution ( int FAR_PTR *Xres, int FAR_PTR *Yres );
  136.  
  137.  
  138.  /* Procedure initializes PBGI, calls Draw(), closes PBGI,
  139.     DOES NOT print picture, and DOES NOT allocate or free the buffer */
  140. int FAR_PROC pascal  PRT_BuildBitMap (
  141.                               int far * graphdriver, int far *graphmode,
  142.                               char far *pathtodriver,
  143.                               int x1,int y1, int x2,int y2,
  144.                               int ( FAR_PTR * FAR_PROC  /* pascal */ Draw)(void) );
  145.  
  146. /* Procedures which may be called before freeing the buffer */
  147. int FAR_PROC _PRT__pascal PRT_InitPrt ( int handle );
  148. int FAR_PROC _PRT__pascal PRT_EndPrt ( int handle );
  149. int   FAR_PROC pascal   PRT_PrintBuffer (int handle);
  150. unsigned FAR_PROC pascal   PRT_getpixel ( int x, int y );
  151. void  FAR_PROC pascal   setfillpattern16 ( char FAR_PTR * upattern, int color );
  152. void  FAR_PROC pascal   getfillpattern16 ( char FAR_PTR * upattern );
  153.  
  154. int   FAR_PROC pascal   PRT_AllocateBuffer ( void );
  155. int   FAR_PROC pascal   PRT_FreeBuffer (void);
  156.  
  157.  
  158. int FAR_PROC pascal PRT_PrintCntrlInfo ( int handle,
  159.                                          char FAR_PTR *s1, int value,
  160.                                          char FAR_PTR * s2,
  161.                                          int NonASCIIwidth );
  162.  
  163.     int FAR_PROC pascal PRT_installuserdriver ( const char far * name, int huge (*detect)(void) );
  164.    int FAR_PROC pascal PRT_registerfarbgidriver ( void far pascal (*driver)(void) );
  165.    int FAR_PROC pascal PRT_Unregisterfarbgidriver ( void far pascal(*driver)(void) );
  166.    int FAR_PROC pascal PRT_SetViewSize( int x1, int y1, int x2, int y2 );
  167.    int FAR_PROC pascal PRT_initgraph( int far * graphdriver, int far *graphmode,
  168.                                        char far *pathtodriver );
  169.                                        /*  int x1, int y1, int x2, int y2 ); */
  170.    int FAR_PROC pascal PRT_closegraph(void); /* DOES NOT free the buffer   */
  171.  
  172.    typedef int _PRT__pascal ( FAR_PROC * pascal PRT_ErrorFuncP) ( int handle );
  173.    typedef int _PRT__pascal ( FAR_PROC * pascal PRT_OpenFuncP)( const char far* outname );
  174.    typedef int _PRT__pascal ( FAR_PROC * pascal PRT_CloseFuncP)( int handle );
  175.    typedef int _PRT__pascal ( FAR_PROC * pascal PRT_WriteFuncP)( int handle, const void FAR_PTR * b,
  176.                                                            unsigned len );
  177. PRT_ErrorFuncP FAR_PROC pascal PRT_SetErrorFunc ( int far _PRT__pascal WrErrFunc(int handle) );
  178. PRT_OpenFuncP  FAR_PROC pascal PRT_SetOpenFunc  ( int far _PRT__pascal f(const char far* outname) );
  179. PRT_CloseFuncP FAR_PROC pascal PRT_SetCloseFunc ( int far _PRT__pascal f(int handle) );
  180. PRT_WriteFuncP FAR_PROC pascal PRT_SetWriteFunc ( int far _PRT__pascal
  181.                                                   f(int handle,
  182.                                                     const void FAR_PTR * b,
  183.                                                     unsigned len) );
  184.  
  185. extern void FAR_PROC pascal BitImage(void);  /* link our bit image BGI driver */
  186.  
  187. #ifdef __cplusplus
  188.    }
  189. #endif
  190.  
  191.  
  192. #ifdef __cplusplus
  193. extern "C" {
  194. #endif
  195.       int _PRT__pascal PRT_Open(const char far* outname);
  196.       int _PRT__pascal PRT_Close( int handle );
  197.       int _PRT__pascal PRT_Write( int handle, const void FAR_PTR * b, unsigned len );
  198. #ifdef __cplusplus
  199.            }
  200. #endif
  201.  
  202.  
  203.    /* end of PRTGRAPH.H  */
  204.